﻿#region using
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework;
using AwesomeTanks.Sources.Collision;
#endregion

namespace AwesomeTanks.Sources.Media
{
    /// <summary>
    /// This class contains all SourceRectangle,Point, ... for Elements in the Sprite Sheet
    /// </summary>
    static class Art
    {
        #region Fields
        /// <summary>
        /// The path of the spritesheet to use.
        /// </summary>
        public const string SPRITESHEET_PATH = @"Game\Textures2D\spritesheet";
        public const string CONTROLS_MENU_PATH = @"Menus\Textures2D\controls";
        public const string TITLE_BACKGROUND_PATH = @"Menus\Textures2D\pineapple";
        public const string MENU_BACKGROUND_PATH = @"Menus\Textures2D\background";


        public static Texture2D SpriteSheet { get; private set; }
        public static Texture2D ControlsMenu { get; private set; }
        public static Texture2D TitleBackground { get; private set; }
        public static Texture2D MenuBackground { get; private set; }

        public static Rectangle BaseTankSourceRectangle = new Rectangle(0, 0, 53, 87);
        public static Vector2 BaseTankOrigin = new Vector2(26, 43);
        public static Color[,] BaseTankColorArray;

        public static Rectangle TurretSourceRectangle = new Rectangle(55, 0, 19, 72);
        public static Vector2 TurretOrigin = new Vector2(9, 62);        

        public static Point ParticlePosition = new Point(76, 0);
        public static Point ParticleDimension = new Point(22, 2);

        public static Point GlowPosition = new Point(100, 0);
        public static Point GlowDimension = new Point(32, 20);

        public static Rectangle GatlingShootSourceRectangle = new Rectangle(76, 0,22,2);
        public static Vector2 GatlingShootOrigin = new Vector2(11, 1);
        public static Color[,] GatlingShootColorArray;

        public static Rectangle RocketShootSourceRectangle = new Rectangle(67, 90, 37, 21);
        public static Vector2 RocketShootOrigin = new Vector2(18, 10);

        public static Rectangle WallSourceRectangle = new Rectangle(77, 0, 1, 1);
        public static Color[,] WallColorArray;

        public static Rectangle PlayerLife = new Rectangle(32, 87, 32, 32);
        public static Rectangle TankLife = new Rectangle(0, 87, 32, 32);

        public static Rectangle InfiniteSourceRectangle = new Rectangle(90, 25, 82, 69);
        public static Vector2 InfiniteOrigin = new Vector2(41, 34);
        #endregion

        #region Methods
        /// <summary>
        /// Loads the specified content.
        /// </summary>
        /// <param name="content">The content.</param>
        public static void Load(ContentManager content)
        {
            SpriteSheet = content.Load<Texture2D>(Art.SPRITESHEET_PATH);
            ControlsMenu = content.Load<Texture2D>(Art.CONTROLS_MENU_PATH);
            TitleBackground = content.Load<Texture2D>(Art.TITLE_BACKGROUND_PATH);
            MenuBackground = content.Load<Texture2D>(Art.MENU_BACKGROUND_PATH);

            BaseTankColorArray = CollisionManager.TextureTo2DArray(Art.SpriteSheet, Art.BaseTankSourceRectangle);
            GatlingShootColorArray = CollisionManager.TextureTo2DArray(Art.SpriteSheet, Art.BaseTankSourceRectangle);
            WallColorArray = CollisionManager.TextureTo2DArray(Art.SpriteSheet, Art.WallSourceRectangle);
        }

        #endregion
    }
}